<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //创建对象
    let obj = {}
    //或者
    let obj1 = new Object

    obj = {
      uname: '蔡徐坤',
      age: 18,
      add: '来自美国',
      'good-baby': 'home', //加横线必须用单引号
      song: function (x, y) {
        return x + y
      }
    }
    //增删改查
    //1.查 ->对象名.属性名  或  对象名['属性名']
    console.log(obj.age)
    console.log(obj['good-baby']); //钩子写法，为了识别加横线的属性名
    //2.改
    obj.age = 19
    //3.增
    obj.hobby = '唱 跳 rap'
    console.log(obj);
    //4.删 了解
    delete obj.hobby;
    console.log(obj);

    //调用方法  对象名.方法名()
    obj1 = {
      song: function () {
        return 11
      }
    }

    console.log(obj1.song());
    console.log(obj.song(3, 5));
  </script>
</body>

</html>